{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load  sizeformat %}

{% block head %}
    <link rel="stylesheet" type="text/css" href="{% static 'vms/vms_list.css' %}">
{% endblock %}
{% block title %}{% translate '恢复虚拟机选项' %}{% endblock %}

{% block boby %}



    <div class="container-fluid col-12">
        <div class="card">
            <div class="card-header">
                <span class="card-title">{% translate '恢复虚拟机' %}</span>
                <span><a class="btn btn-sm btn-primary float-right" href="{% url 'vms:shelve-list' %}">
                    {% translate '搁置虚拟机列表' %}
                </a></span>
            </div>
            <div class="card-body align-content-center">
                <form class="form-horizontal">
                    <div class="form-group row">
                        <label for="id-center" class="offset-sm-1 col-sm-2 text-right col-form-label">{% translate '数据中心' %}</label>
                        <div class="col-sm-7">
                            <select name="center_id" class="form-control" id="id-center">
                                {% for c in centers %}
                                    <option value="{{ c.id }}"
                                            {% if c.id == center_id %}selected{% endif %}>{{ c.name }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                </form>
                <form class="form-horizontal" id="id-form-vm-unshelve">
                    <div class="form-group row">
                        <label for="id-group" class="offset-sm-1 col-sm-2 text-right col-form-label">{% translate '主机组' %}</label>
                        <div class="col-sm-7">
                            <select name="group_id" class="form-control" id="id-group">
                                {% for g in groups %}
                                    <option value="{{ g.id }}"
                                            {% if g.id == group_id %}selected{% endif %}>{{ g.name }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="id-vlan" class="offset-sm-1 col-sm-2 text-right col-form-label">{% translate '网段' %}</label>
                        <div class="col-sm-7">
                            <select name="vlan_id" class="form-control" id="id-vlan">
                                <option value="">{% translate '自动选择' %}</option>
                                {% for v in vlans %}
                                    <option value="{{ v.id }}"
                                            {% if v.id == vlan_id %}selected{% endif %}>{{ v.name }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="id-ipv4" class="offset-sm-1 col-sm-2 text-right col-form-label">{% translate 'IP地址' %}</label>
                        <div class="col-sm-7">
                            <select name="ipv4" class="form-control" id="id-ipv4">
                                {% if last_ip %}
                                <option value="{{ last_ip.id }}">{{ last_ip.ipv4 }}</option>
                                {% else %}
                                <option value="">{% translate '自动选择' %}</option>
                                {% endif %}
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="id-host" class="offset-sm-1 col-sm-2 text-right col-form-label">{% translate '宿主机' %}</label>
                        <div class="col-sm-7">
                            <select name="host_id" class="form-control" id="id-host">
                                <option value="">{% translate '自动选择' %}</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <div class="offset-sm-1 col-sm-2">
                            <button class="btn btn-primary float-right" id="unshelve_submit"
                                    data-vm-uuid="{{ vm_uuid }}">{% translate '恢复' %}
                            </button>
                        </div>
                    </div>
                </form>
            </div>
            <div class="panel-footer">

            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script type="text/javascript" src="{% static 'evcloud/common.js' %}"></script>
    <script type="text/javascript" src="{% static 'art-template/template-web.js' %}"></script>
    <script type="text/javascript" src="{% static 'vms/vms_create.js' %}"></script>
    <script type="text/javascript" src="{% static 'vms/vms_shelve_list.js' %}"></script>
{% endblock %}

